package com.xuan.juc;
/*
* 线程就是一个单独的资源类，没有任何附属的操作
*
*
* */
public class Test1 {
    public static void main(String[] args) {
        // 获取cpu的核数
        // cpu 密集型 io密集型
        System.out.println(Runtime.getRuntime().availableProcessors());

        Ticket ticket = new Ticket();
        new Thread(() ->{ticket.sale();},"A").start();


    }

    public void testGit(){
        System.out.println("dev info! merge to master! save this!");
    }

    public void testGit2(){
        System.out.println("rebase this！");
    }
}


// 资源类 oop
class Ticket{

    private int num = 10;

    // 本质 锁
    public synchronized void sale(){
        if(num > 0){

        }
    }

}